package edu.zut.operator;

public class OperatorDemo {

    public static void main(String[] args) {
        //一元运算   -   --   ++
        int i = 100;
        int j = -i;
        System.out.println(j);
        // ++ 自增 1     --   自减 1
        i++;   //101
        //  = 赋值  将右边的赋值给左边
//        i = i + 1;
        System.out.println("i = " + i);
        i--; //100
//        i = i - 1;
        System.out.println("i = " + i);

        int a = 50;
        ++a;
        System.out.println("a = " + a);  //51
        --a;
        System.out.println("a = " + a); //50

        // ++  -- 和赋值=  一起使用时
        int b;
        b = a++;  //  1. b = a; a = a + 1
        System.out.println("b = " + b); //50
        System.out.println("a = " + a); //51
        // ++ 在前
        b = ++a;
        System.out.println("b = " + b); //52
        System.out.println("a = " + a); //52

        

    }


}
